package com.ygqh.baby.service.wechat.model.good;

import com.foxinmy.weixin4j.exception.WeixinException;
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;

/**
 * 好物圈导入物品请求参数
 *
 * @Author: sunshuo
 * @Date: 2019/5/24 17:29
 * @Version: 1.0
 */
public class GoodImportProductRequestParam {

	/**
	 * 单次请求物品数量不可超过10个
	 */
	private List<GoodProduct> productList;

	public List<GoodProduct> getProductList() {
		return productList;
	}

	public void setProductList(List<GoodProduct> productList) {
		this.productList = productList;
	}

	@Override
	public String toString() {
		return "GoodImportProductRequestParam{" +
				"productList=" + productList +
				'}';
	}

	public void validateRequestParamForImport() throws WeixinException {
		if (CollectionUtils.isEmpty(productList)) {
			throw new WeixinException("物品信息集为空");
		}
	}

	public String getRequestUri() {
		return "https://api.weixin.qq.com/mall/importproduct?access_token=%s";
	}
}
